<?php
/**
* Django's templating engine (partial) PHP implementation
* @link http://djangoproject.com Django
* this file is from a webappkit package (kit)
* @link http://webappkit.net
* @package djtpl
* @author J.Ducastel <jeremie@ducastel.name>
* @license http://opensource.org/licenses/gpl-license.php GNU Public License
*/

$GLOBALS['DJTPL_STORAGES']=array();

/**
 * API wrapper for dj/tpl kit
 * @static
 */
class DjTpl {

    /**
     * keeps a list of template storages to search within
     * @static
     * @param DjTplStorage $storage a storage instance to add
     * @return bool
     */
    function addStorage(&$storage) {
        if (!is_a($storage,'DjTplStorage'))
            return false;
        static $n=0;
        $GLOBALS['DJTPL_STORAGES'][$n]=&$storage;
        $n++;
        return true;
    }

    /**
     *
     */


    /**
     * retrieves a template from known storages
     * @static
     * @param string $id
     * @return DjTplTemplate
     */
    function getTemplate($id) {
        // global $DJTPL_STORAGES;
        foreach ($GLOBALS['DJTPL_STORAGES'] as $store) {
            // echo '<pre>'; print_r($store);
            if ($tpl=&$store->get($id))
                return $tpl;
        }
        return false;
    }
}
?>